2 using System.Collections.Generic;
5 using Microsoft.Xna.Framework;
6 using Microsoft.Xna.Framework.Graphics;
7 using Microsoft.Xna.Framework.Content;
9 namespace SuperPolarity
11 static class ActorFactory
13 static internal SuperPolarity Game;
15 static public MainShip CreateMainShip(Vector2 position)
17 MainShip mainShip = new MainShip(Game);
18 mainShip.Initialize(Game.Content.Load<Texture2D>("Graphics\\main-ship"), position);
20 ActorManager.CheckIn(mainShip);
21 Renderer.CheckIn(mainShip);
26 static public StandardShip CreateShip(Ship.Polarity polarity, Vector2 position)
28 StandardShip ship = new StandardShip(Game);
31 if (polarity == Ship.Polarity.Positive)
33 texture = Game.Content.Load<Texture2D>("Graphics\\positive-ship");
35 else if (polarity == Ship.Polarity.Negative)
37 texture = Game.Content.Load<Texture2D>("Graphics\\negative-ship");
41 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-ship");
44 ship.Initialize(texture, position);
45 ship.SetPolarity(polarity);
47 ActorManager.CheckIn(ship);
48 Renderer.CheckIn(ship);
53 internal static void SetGame(SuperPolarity game)
55 ActorFactory.Game = game;
58 internal static Bullet CreateBullet(Vector2 position, float angle)
60 Bullet bullet = new Bullet(Game);
62 bullet.Initialize(Game.Content.Load<Texture2D>("Graphics\\square"), position);
66 ActorManager.CheckIn(bullet);
67 Renderer.CheckIn(bullet);
72 static public StandardShip CreateScout(Ship.Polarity polarity, Vector2 position)
74 StandardShip ship = new StandardShip(Game);
77 if (polarity == Ship.Polarity.Positive)
79 texture = Game.Content.Load<Texture2D>("Graphics\\positive-scout");
81 else if (polarity == Ship.Polarity.Negative)
83 texture = Game.Content.Load<Texture2D>("Graphics\\negative-scout");
87 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-scout");
90 ship.BoxDimensions.X = 10;
91 ship.BoxDimensions.Y = 10;
92 ship.BoxDimensions.W = 10;
93 ship.BoxDimensions.Z = 10;
95 ship.Initialize(texture, position);
96 ship.MaxVelocity = 5.5f;
97 ship.FleeVelocity = 6.5f;
98 ship.ChargeVelocity = 5.5f;
101 ship.AngleChangeProbability = 20;
102 ship.SetPolarity(polarity);
104 ActorManager.CheckIn(ship);
105 Renderer.CheckIn(ship);
110 static public StandardShip CreateCruiser(Ship.Polarity polarity, Vector2 position)
112 StandardShip ship = new StandardShip(Game);
115 if (polarity == Ship.Polarity.Positive)
117 texture = Game.Content.Load<Texture2D>("Graphics\\positive-cruiser");
119 else if (polarity == Ship.Polarity.Negative)
121 texture = Game.Content.Load<Texture2D>("Graphics\\negative-cruiser");
125 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-cruiser");
128 ship.BoxDimensions.X = 40;
129 ship.BoxDimensions.Y = 40;
130 ship.BoxDimensions.W = 40;
131 ship.BoxDimensions.Z = 40;
133 ship.Initialize(texture, position);
134 ship.MaxVelocity = 0.5f;
135 ship.FleeVelocity = 5;
136 ship.ChargeVelocity = 1;
139 ship.SetPolarity(polarity);
141 ActorManager.CheckIn(ship);
142 Renderer.CheckIn(ship);